namespace Asmex.FileViewer
{
    using Asmex.ObjViewer;
    using System;
    using System.IO;

    public class COFFHeader : Region
    {
        private ushort _Characteristics;
        private ushort _Machine;
        private ushort _NumberOfSections;
        private uint _NumberOfSymbols;
        private ushort _OptionalHeaderSize;
        private uint _SymbolTablePointer;
        private uint _TimeDateStamp;

        public COFFHeader(BinaryReader reader)
        {
            base.Start = reader.BaseStream.Position;
            base.Length = 20L;
            this._Machine = reader.ReadUInt16();
            this._NumberOfSections = reader.ReadUInt16();
            this._TimeDateStamp = reader.ReadUInt32();
            this._SymbolTablePointer = reader.ReadUInt32();
            this._NumberOfSymbols = reader.ReadUInt32();
            this._OptionalHeaderSize = reader.ReadUInt16();
            this._Characteristics = reader.ReadUInt16();
        }

        public ushort Characteristics
        {
            get
            {
                return this._Characteristics;
            }
        }

        public ushort Machine
        {
            get
            {
                return this._Machine;
            }
        }

        public ushort NumberOfSections
        {
            get
            {
                return this._NumberOfSections;
            }
        }

        public uint NumberOfSymbols
        {
            get
            {
                return this._NumberOfSymbols;
            }
        }

        public ushort OptionalHeaderSize
        {
            get
            {
                return this._OptionalHeaderSize;
            }
        }

        [ObjViewer(Hex=true)]
        public uint SymbolTablePointer
        {
            get
            {
                return this._SymbolTablePointer;
            }
        }

        [ObjViewer(Hex=true)]
        public uint TimeDateStamp
        {
            get
            {
                return this._TimeDateStamp;
            }
        }
    }
}
